package com.jy.adscm.zltx.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jy.adscm.bean.system.JyDept;
import com.jy.adscm.exception.AdscmSystemException;
import com.jy.adscm.support.SimpleCoreResponse;
import com.jy.adscm.system.service.JyDeptService;
import com.jy.adscm.zltx.bean.QsQsfileDept;
import com.jy.adscm.zltx.service.QsQsfileDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zyl
 * @since 2018-11-02
 */
@RestController
@RequestMapping("/adscm/zltx/qsQsfileDept")
public class QsQsfileDeptController {
    @Autowired
    QsQsfileDeptService qsQsfileDeptService;
    @Autowired
    JyDeptService jyDeptService;
@RequestMapping("selectByFileId/{fileId}")
   public SimpleCoreResponse selectByFileId(@PathVariable Integer fileId)throws AdscmSystemException {
       List<QsQsfileDept> qsQsfileDepts = qsQsfileDeptService.selectByFileId(fileId);
       return new SimpleCoreResponse("200","查询成功",qsQsfileDepts);
   }
   @RequestMapping("/selectAllDept")
   public  SimpleCoreResponse selectAllDept()throws AdscmSystemException{
       Wrapper<JyDept> wrapper=new EntityWrapper<>();
       List<JyDept> jyDepts = jyDeptService.selectList(wrapper);
       return  new  SimpleCoreResponse("200","查询成功",jyDepts);
   }
    @RequestMapping("insert")
   public  SimpleCoreResponse insert(QsQsfileDept qsQsfileDept)throws AdscmSystemException{
        boolean insert = qsQsfileDeptService.insert(qsQsfileDept);
        return  new SimpleCoreResponse("200","查询成功",insert);
   }
    @RequestMapping("update")
   public  SimpleCoreResponse update(QsQsfileDept qsQsfileDept)throws AdscmSystemException{
        boolean b = qsQsfileDeptService.updateById(qsQsfileDept);
        return  new SimpleCoreResponse("200","查询成功",b);
   }


}

